import React from "react";
import {Avatar, Flex, Statistic} from "antd";
import {getDaySegment} from "@/utils/JvyouDateUtils.ts";
import {IUserInfo} from "@/api/authentication.ts";
import {useTranslation} from "react-i18next";

interface HomeHeaderProps {
  user: IUserInfo
}

const HomeHeader: React.FC<HomeHeaderProps> = ({user}: HomeHeaderProps) => {

  const {t} = useTranslation()

  return (
    <div>
      <Flex align="center" justify="space-between">
        <div>
          <Avatar src={user.avatar} size={52} style={{float: "left"}}/>
          <Flex className="home-header-greeting" vertical justify="center">
            <h3>{getDaySegment()}好，{user.nickName}，祝你一天开心!</h3>
            <span>人烟寒橘柚，秋色老梧桐</span>
          </Flex>
        </div>
        <Flex align="center" justify="center" className="home-header-statistic">
          <Statistic title={t('home.teamRanking')} value="1/8" style={{margin: "0 10px"}}/>
          <Statistic title="项目数" value={6} style={{margin: "0 10px"}}/>
          <Statistic title="项目访问" value={2344} style={{margin: "0 10px"}}/>
        </Flex>
      </Flex>
    </div>
  )
}

export default HomeHeader